package com.wsl.Uuid;

import com.wsl.Date.DateUtil;

import java.util.Date;
import java.util.UUID;

/**
 * @Author: wsl
 * @Date: 2022/4/1 9:12
 */
public class UuidUtils {


    //格式 时间+UUID 大写
    public static String getDateUUidUpperCase(){
        String uuid = UUID.randomUUID().toString().replace("-","").toUpperCase();
        String date = DateUtil.getStringDateShort().replace("-","");
        return date+uuid;
    }

    //格式  时间+UUID 小写
    public static String getDateUUidLowerCase(){
        String uuid = UUID.randomUUID().toString().replace("-","").toLowerCase();
        String date = DateUtil.getStringDateShort().replace("-","");
        return date+uuid;
    }

    //格式 UUID 大写
    public static String getUUIDUpperCase(){
        return UUID.randomUUID().toString().replace("-","").toUpperCase();
    }

    //格式 UUID 大写
    public static String getUUIDLowerCase(){
        return UUID.randomUUID().toString().replace("-","").toUpperCase();
    }

    //返回指定长度的UUID
    public static String getUUIDLength(int len){
        if (0>=len) {
            return null;
        }
        return getUUIDUpperCase().substring(0,len);
    }




}